{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from rl_trainer.controller import Controller\n",
    "from zerosum_env import make, evaluate\n",
    "from zerosum_env.envs.halite.helpers import *\n",
    "\n",
    "\n",
    "player = Controller()\n",
    "player.restore('./model/latest_ship_model.pth')\n",
    "\n",
    "\n",
    "# function for testing agent\n",
    "def take_action(observation, configuration):\n",
    "    board = Board(observation, configuration)\n",
    "    action = player.take_action(board, \"sample\")\n",
    "    return action\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "env = make(\"halite\", configuration={\"episodeSteps\":300, \"randomSeed\":5609})\n",
    "env.reset(2)\n",
    "\n",
    "player.prepare_test()\n",
    "info = env.run([take_action, \"random\"])\n",
    "\n",
    "env.render(mode=\"ipython\", width=800, height=500)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
